import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

//导入富文本编辑器
import {QuillEditor} from '@vueup/vue-quill';
import '@vueup/vue-quill/dist/vue-quill.snow.css'

//导入element
import installElementPlus from './plugins/element'

//导入全局样式表
import("./assets/global.css")
//导入iconfont
import("./assets/font/iconfont.css")

//导入进度条
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

//导入axios
import axios from "axios"
axios.defaults.baseURL = "http://127.0.0.1:8888/api/private/v1"
//request拦截器
axios.interceptors.request.use(config => {
  //展示进度条
  NProgress.start()
  //添加头部信息
  config.headers.Authorization = sessionStorage.getItem("Token");
  return config;
})
//response拦截器
axios.interceptors.response.use(config=>{
  NProgress.done();
  return config;
})

const app = createApp(App);
app.use(store);
app.use(router)

app.mount('#app')
installElementPlus(app)
app.config.globalProperties.$http = axios
app.component('QuillEditor',QuillEditor)
